/*
 * @Descripttion: 
 * @version: 
 * @Author: TT
 * @Date: 2023-10-21 17:25:53
 * @LastEditors: TT
 * @LastEditTime: 2023-10-28 15:27:30
 */
import 'package:flutter/material.dart';
import 'package:hzy_project_template/base_ui_config/base_ui_config_index.dart';
import 'package:hzy_project_template/commpontents/commpontents_index.dart';
import 'package:hzy_project_template/config/config_index.dart';

import '../models/tu_chong_model.dart';

class ExampleTuTagsWidget extends CommonLessWidget {
  final TuChongItem tuChongItem;

  const ExampleTuTagsWidget({
    super.key,
    required this.tuChongItem,
  });

  @override
  Widget createBody({
    required BuildContext context,
    BoxConstraints? constraints,
  }) {
    Widget body = Container();
    body = Wrap(
      spacing: 6,
      runSpacing: 6,
      children: [
        ...List.generate(
          tuChongItem.tagColors?.length ?? 0,
          (index) {
            Widget body = Container(
              decoration: BoxDecoration(
                color: tuChongItem.tagColors?[index],
                borderRadius: BorderRadius.circular(
                  4.r,
                ),
                boxShadow: [
                  configShadow(),
                ],
              ),
              padding: EdgeInsets.symmetric(
                horizontal: 6.w,
                vertical: 2.w,
              ),
              child: Text(
                tuChongItem.tags?[index] ?? "",
                style: HzyTextStyle.fontMedium(
                  size: 12.sp,
                  color: Colors.white,
                ),
              ),
            );
            return body;
          },
        ),
      ],
    );
    return body;
  }
}
